package com.gxa.order.controller;

import com.gxa.common.commons.R;
import com.gxa.order.service.HotelManageService;
import com.gxa.order.service.RoomTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;

@RestController
@RequestMapping(value = "/HotelManage")
public class HotelManageController {

    @Autowired
    private HotelManageService hotelManageService;

    /**
     * 审核通过
     * @param id
     * @return
     */
    @GetMapping("/agreeExamine")
    public R agreeExamine(Integer id){
        return hotelManageService.agreeExamine(id);
    }

    /**
     * 审核不通过
     * @param id
     * @return
     */
    @GetMapping("/notAgreeExamine")
    public R notAgreeExamine(Integer id){
        return hotelManageService.notAgreeExamine(id);
    }

    /**
     * 换房
     * @param map 需要住宿订单id，房间号
     * @return
     */
    @PostMapping("/exchangeRoom")
    public R exchangeRoom(@RequestBody HashMap map){
        return hotelManageService.exchangeRoom(map);
    }

    /**
     * 退房
     * @return
     */
    @PostMapping("/checkOut")
    public R checkOut(@RequestBody HashMap map){
        return hotelManageService.checkOut(map);
    }
    @Resource
    private RoomTypeService roomTypeService;

    /**
     *修改房型已用数量(添加)
     */
    @GetMapping(value = "/addRoomUsed")
    public void addRoomUsed(Integer roomTypeId){
        roomTypeService.addRoomUsed(roomTypeId);
    }

    /**
     *修改房型已用数量(添加)
     */
    @GetMapping(value = "/downRoomUsed")
    public void downRoomUsed(Integer roomTypeId){
        roomTypeService.downRoomUsed(roomTypeId);
    }


}
